﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ClientRegister
{
    public partial class EmployeeManageForm : Form
    {

        public string ID { set; get; }
        public string Password { set; get; }
        public string Name { set; get; }

        EmployeesDataProvider emp = new EmployeesDataProvider();
        TeacherDataProvider teacher = new TeacherDataProvider();
        SubjectsDataProvider sub = new SubjectsDataProvider();
        RoomDataProvider room = new RoomDataProvider();

        public EmployeeManageForm()
        {
            InitializeComponent();
        }

        private void đổiMậtKhẩuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ChangePasswordForm dmkform = new ChangePasswordForm();
            dmkform.ID = ID;
            dmkform.Password = Password;
            dmkform.Show();
        }

        private void thoátToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

    //Them nhan vien su dung phan mem
        private void ThemNVToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddEmployeeForm add = new AddEmployeeForm();
            add.Show();
        }

        private void SuaNhanViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListEmployeesForm emplst = new ListEmployeesForm();
            emplst.Show();
        }



    //Them Giao vien
        private void ThemGVToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddTeacherForm add = new AddTeacherForm();
            add.Show();
        }

    //Them mon hoc
        private void thêmMônHọcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddSubjectForm addsub = new AddSubjectForm();
            addsub.Show();
        }

    //Them phong hoc
        private void thêmPhòngHọcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddRoomForm addroom = new AddRoomForm();
            addroom.Show();
        }

        private void SuaGiaoVienToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListTeacherForm change = new ListTeacherForm();
            change.Show();
        }


        private void xóaMônHọcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListSubjectsForm sub = new ListSubjectsForm();
            sub.Show();
        }

        private void xóaPhòngHọcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListRoomForm room = new ListRoomForm();
            room.Show();
        }

        private void EmployeeManageForm_Load(object sender, EventArgs e)
        {
            GridEmp.DataSource = emp.SelectAllEmp().Tables[0];
            GridTeacher.DataSource = teacher.SelectAllTeacher().Tables[0];
            GridSub.DataSource = sub.LoadSubject().Tables[0];
            GridRoom.DataSource = room.LoadRoom().Tables[0];
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            GridEmp.DataSource = emp.SelectAllEmp().Tables[0];
            GridTeacher.DataSource = teacher.SelectAllTeacher().Tables[0];
            GridSub.DataSource = sub.LoadSubject().Tables[0];
            GridRoom.DataSource = room.LoadRoom().Tables[0];
        }
    }
}
